<?php

namespace addons\aqueue\library\jobs;

use think\Db;
use think\Log;
use think\queue\Job;

class RedisJobnew
{
    public function fire(Job $job, $data)
    {
        //执行业务处理

        $where['key'] = 1;
        $redis_test = Db::name('redis_test')
        ->where($where)
        ->find();
        $update['key'] = 2;
        $update['value'] = time();
        Db::name('redis_test')->where('id',$redis_test['id'])->update($update);

        $job->delete();//任务执行成功后删除
        //检查任务重试次数
        if($job->attempts() > 3){
            $job->delete();
        }
    }

}